package com.compass.doctor.ui.chat

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.databinding.LayoutImCaseItemBinding
import com.compass.doctor.databinding.LayoutPatientPictureBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.ext.gone
import com.compass.framework.ext.visible
import com.compass.framework.glide.setUrl
import com.compass.framework.helper.CompassAppHelper
import com.compass.framework.utils.StatusBarSettingHelper
import com.compass.framework.utils.ViewUtils
import com.compass.framework.utils.dpToPx

/**
 * Description： 问诊单图片
 * Date:2024/3/28 15:18
 */
class ImPictureAdapter : BaseRecyclerViewAdapter<String, LayoutImCaseItemBinding>() {





    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutImCaseItemBinding>,
        item: String?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            ViewUtils.setClipViewCornerRadius(imgPic, dpToPx(5))

            imgPic.setUrl(item)
            val width = StatusBarSettingHelper.getScreenWidth(CompassAppHelper.getApplication()) - dpToPx(100)
            var layoutParams = relParent.layoutParams
            layoutParams.width = width / 4
            layoutParams.height = width / 4


        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutImCaseItemBinding {
        return LayoutImCaseItemBinding.inflate(layoutInflater, parent, false)
    }
}